home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / os2tools / bnklysrc / b_wazoo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-01-01  |  7.6 KB  |  202 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software <no-Inc>                   */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          No-Cost<no-tm> Software.                       */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  Copyright (C) 1987, 1988, 1989 by Robert Hartman and Vincent Perriello  */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*                      BinkleyTerm "WaZOO" Processor                       */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*    For complete  details  of the licensing restrictions, please refer    */
  17. /*    to the License  agreement,  which  is published in its entirety in    */
  18. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.210.    */
  19. /*                                                                          */
  20. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  21. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  22. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  23. /*    NOT HAVE THESE FILES,  YOU SHOULD  IMMEDIATELY CONTACT THE AUTHORS    */
  24. /*    AT THE  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO    */
  25. /*    USE   THIS  FILE  WITHOUT  HAVING   ACCEPTED  THE  TERMS  OF   THE    */
  26. /*    BINKLEYTERM  LICENSING AGREEMENT,  OR SUCH OTHER  AGREEMENT AS YOU    */
  27. /*    ARE ABLE TO REACH WITH THE AUTHORS.                                   */
  28. /*                                                                          */
  29. /*                                                                          */
  30. /*    The Authors can be reached at the following addresses:                */
  31. /*                                                                          */
  32. /*    Robert C. Hartman                      Vincent E. Perriello           */
  33. /*    Spark Software                         VEP Software                   */
  34. /*    427-3 Amherst Street                   111 Carroll Street             */
  35. /*    CS2032, Suite 232                      Naugatuck, CT 06770            */
  36. /*    Nashua, NH 03061                                                      */
  37. /*                                                                          */
  38. /*    FidoNet 1:132/101                      FidoNet 1:141/491              */
  39. /*    Data    (603) 888-8179                 Data    (203) 729-7569         */
  40. /*                                                                          */
  41. /*    Please feel free to contact us at any time to share your comments     */
  42. /*    about our software and/or licensing policies.                         */
  43. /*                                                                          */
  44. /*                                                                          */
  45. /*  This module is based largely on a similar module in OPUS-CBCS V1.03b.   */
  46. /*  The original work is (C) Copyright 1987, Wynn Wagner III. The original  */
  47. /*  author has graciously allowed us to use his code in this work.          */
  48. /*                                                                          */
  49. /*--------------------------------------------------------------------------*/
  50.  
  51. #include <signal.h>
  52. #include <ctype.h>
  53. #include <conio.h>
  54.  
  55. #define WAZOO_SECTION
  56. #define MATRIX_SECTION
  57.  
  58. #include "com.h"
  59. #include "xfer.h"
  60. #include "zmodem.h"
  61. #include "keybd.h"
  62. #include "sbuf.h"
  63. #include "sched.h"
  64. #include "externs.h"
  65. #include "prototyp.h"
  66.  
  67. static int get_ZedZap (char *, FILE *);
  68. static int send_ZedZap (char *, char *, int, int);
  69. static int (*wzgetfunc) (char *, FILE *);
  70.  
  71. int (*wzsendfunc) (char *, char *, int, int);
  72. extern int WaZOO_callback (char *);
  73.  
  74.  
  75. static int get_ZedZap (rcvpath, xferinfo)
  76. char *rcvpath;
  77. FILE *xferinfo;
  78. {
  79.    return (get_Zmodem (rcvpath, xferinfo));
  80. }
  81.  
  82. static int send_ZedZap (fname, alias, fsent, wazoo)
  83. char *fname;
  84. char *alias;
  85. int fsent;
  86. int wazoo;
  87. {
  88.    return (Send_Zmodem (fname, alias, fsent, wazoo));
  89. }
  90.  
  91. /*--------------------------------------------------------------------------*/
  92. /* WaZOO                                                                    */
  93. /*--------------------------------------------------------------------------*/
  94. void WaZOO (originator)
  95. int originator;
  96. {
  97.    int stat;
  98.    int i = 0;
  99.    
  100.    /*--------------------------------------------------------------------*/
  101.    /* Initialize WaZOO                                                   */
  102.    /*--------------------------------------------------------------------*/
  103.    stat =
  104.       made_request =
  105.       got_arcmail =
  106.       got_packet = 0;
  107.  
  108.    Netmail_Session = 1;
  109.  
  110.    isOriginator = originator;
  111.  
  112.    if (originator && ((remote_zone != called_zone) || (remote_net != called_net) || (remote_node != called_node)))
  113.       {
  114.       status_line ("!Called %d:%d/%d and got %d:%d/%d",
  115.                    called_zone, called_net, called_node,
  116.                    remote_zone, remote_net, remote_node);
  117.       }
  118.    else
  119.       {
  120.       called_zone = remote_zone;
  121.       called_net = remote_net;
  122.       called_node = remote_node;
  123.       }
  124.  
  125.    if (!CARRIER)
  126.       return;
  127.  
  128.  
  129. #ifdef JANUS
  130.    /* Try Janus first */
  131.    if ((remote_capabilities & DOES_IANUS) && (janus_baud >= cur_baud))
  132.       {
  133.       Janus ();
  134.       mdm_hangup ();
  135.       return;
  136.       }
  137. #endif
  138.  
  139.  
  140.    /* See if we can both do ZEDZAP */
  141.    if (remote_capabilities & ZED_ZAPPER)
  142.       {
  143.       status_line (":WaZOO method: ZedZap");
  144.       wzgetfunc = get_ZedZap;
  145.       wzsendfunc = send_ZedZap;
  146.       }
  147.    else
  148.       {
  149.       status_line (":WaZOO method: DietIfna");
  150.       if (originator)
  151.          {
  152.          FTSC_sender (1);
  153.          }
  154.       else
  155.          {
  156.          FTSC_receiver (1);
  157.          }
  158.       return;
  159.       }
  160.  
  161.  
  162.    /*--------------------------------------------------------------------*/
  163.    /* ORIGINATOR: send/receive/send                                      */
  164.    /*--------------------------------------------------------------------*/
  165.    if (originator)
  166.       {
  167.  
  168.       send_WaZOO ();
  169.       if (!CARRIER)
  170.          goto endwazoo;
  171.       if (!(*wzgetfunc) (CurrentNetFiles, NULL))
  172.          goto endwazoo;
  173.  
  174.       if (!CARRIER)
  175.          goto endwazoo;
  176.       stat = respond_to_file_requests (i, WaZOO_callback);
  177.       if (stat)
  178.          (*wzsendfunc) (NULL, NULL, ((stat) ? END_BATCH : NOTHING_TO_DO), DO_WAZOO);
  179.       mail_finished = 1;
  180.       }
  181.  
  182.    /*--------------------------------------------------------------------*/
  183.    /* CALLED SYSTEM: receive/send/receive                                */
  184.    /*--------------------------------------------------------------------*/
  185.    else
  186.       {
  187.       if (!(*wzgetfunc) (CurrentNetFiles, NULL))
  188.          goto endwazoo;
  189.       if (!CARRIER)
  190.          goto endwazoo;
  191.       send_WaZOO ();
  192.       if (!CARRIER || !made_request)
  193.          goto endwazoo;
  194.       (*wzgetfunc) (CurrentNetFiles, NULL);
  195.  
  196.       }
  197.  
  198. endwazoo:
  199.    status_line ("*End of WaZOO Session");
  200.  
  201. }                                                /* wazoo */
  202.